<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div th:include="login::nav">
</div>
<hr>
<div style="display: flex">
    <div style="flex: 2">
    <table border="1">
    <tr>
        <th>ID</th>
        <th>学生名称</th>
        <th>学生手机号</th>
        <th>班级编号</th>
        <th>班级名称</th>
        <th>图片</th>
        <th>操作</th>
    </tr>
        <tr th:each="x:${user}">
            <td th:text="${x.uid}"></td>
            <td  th:text="${x.uname}"></td>
            <td  th:text="${x.phone}"></td>
            <td th:text="${x.clz.clzno}"></td>
            <td th:text="${x.clz.clzname}"></td>

            <td>
                <!-- vw屏幕宽度 100vw-->
                <div style="width: 10vw;height: 10vw">
                    <img style="width: 100%;height: 100%" th:src="'/admstu/showimg/'+${x.pic}"/>
                </div>
            </td>
            <td><a th:href="'/admstu/go2update?uid='+${x.uid}">修改</a></td>
            <td><a th:href="'/admstu/del?uid='+${x.uid}">删除</a></td>
        </tr>
    </table>
    </div>
    <div style="flex: 1">
        <button><a href="/admstu/go2add">添加一位学生</a></button>
        <hr>
        <div th:if="${action}=='add'">
        <form action="/admstu/add" method="post" enctype="multipart/form-data">
            <h2>添加学生</h2>
            编号:<input type="text" name="uid"/><br>
            名字:<input type="text" name="uname"/><br>
            电话:<input type="text" name="phone"/><br>
            密码:<input type="text" name="pwd"/><br>
            图片:<input type="file" name="pic" /><br>
            班级名称:<select name="clzno" >
            <option th:each="x:${clz}"
                    th:text="${x.clzname}"
                    th:value="${x.clzno}"></option>
        </select><br>
            <input  type="submit"/>
        </form>
        </div>
        <div th:if="${action}==update" th:each="x:${user1}">
            <form action="/admstu/update" method="post" enctype="multipart/form-data">
                <h2>修改学生</h2>
                编号:<input type="text" name="uid" th:value="${userp.uid}"/><br>
                名字:<input type="text" name="uname"/><br>
                电话:<input type="text" name="phone"/><br>
                密码:<input type="text" name="pwd"/><br>
                <td>
                    <!-- vw屏幕宽度 100vw-->
                    <div style="width: 10vw;height: 10vw">
                        <img style="width: 100%;height: 100%" th:src="'/admstu/showimg/'+${x.pic}"/>
                    </div>
                </td>
                图片:<input type="file" name="pic" /><br>
                班级名称:<select name="clzno" >
                <option th:each="x:${clz}"
                        th:text="${x.clzname}"
                        th:value="${x.clzno}"></option>
            </select><br>
                <input  type="submit"/>
            </form>
        </div>
    </div>
</div>

</body>
</html>